#include<bits/stdc++.h>
using namespace std;
int n; const int maxn = 1e5+8;
typedef long long ll;
ll d[maxn];
int main() {
  int t; cin>>t;
  while(t--) {
    cin>>n; for(int i=0; i<n; ++i) cin>>d[i];
    sort(d, d+n);
    ll ans = 0, sum = 0;
    for(int i=0; i<n; ++i) {
      ans -= 1LL*i*d[i]-sum;
      sum += d[i];
    }
    ans += d[n-1];
    cout<<ans<<'\n';
  }
}
